-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include custom OpenGL loader header from define. #4649
Conversation
In case of Windows and custom loader file, no OpenGL API is visible to OpenGL3 implementation. It is needed to include loader header that provides it. Can be provided via CMake for example: target_compile_definitions(target PRIVATE IMGUI_IMPL_OPENGL_LOADER_CUSTOM="custom_opengl3_loader.h") Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>
I think this may be a breaking change and in some situation (e.g. unity build #4646) this may be undesirable. |
How does it compile if no GL header is included (in case of defined On Windows setup with OpenGL backend and custom loader generated with gl3w that is not part of imgui it fails on basic GL types like GLuint and so on inside imgui_impl_opengl3.cpp. May be I am missing something and custom include can be provided by other means. |
Signed-off-by: Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>
With Unity builds you build everything as a single file. So you don't build
Generally speaking, imgui/backends/imgui_impl_opengl3.cpp Line 125 in 13cdf2f
Unless you have a specific need to, you should just let Dear ImGui use it. (IE: Don't define |
This was on a first iteration, but re-generating it adding more and more GL API in evolving project is not convenient. (full API generated loader works) |
You don't have to (and generally shouldn't) use the minimal Dear ImGui loader directly, it should only be used by the backend. You can continue to use Glad/GL3W/whatever as per usual for your own code. |
Unfortunately, two gl3w wrappers in same project do not work together. That is already tried. Nevertheless of my project, if |
Our gl3w wrapper was designed to not conflict with another gl3w wrapper linked in the same project, so that works. But the GL includes probably need to be in a different compilation unit.
|
I think you may be on a XY Problem here. Two OpenGL loaders in same project does/should work. You should focus on solving this. |
Does or should? If it does, please point me to working example. I could extract to small test app what does not work, if it will help you understand the issue better. So far points:
|
It was already discussed in #4445 and it worked then and no changes have been made.
If you use a custom loader for imgui_impl_opengl3.cpp it needs to expose a GL api, that's the point of a loader.
It should not, we discussed this in #4445 and fixed remaining bugs back then. We designed our gl3w fork to not have conflicting linking symbols with gl3w. The last known fix was merged on Aug 24. Either way we are discussing a XY Problem. Should solve this instead of using a custom loader for imgui_impl_opengl3.cpp |
That is exactly the purpose of my pull request. To provide GL API via custom loader header to backend when it is not used as a single translation unit (in case of Unity). |
This is a root cause with conflicting symbols, I used same scripts to generate custom app loader with extended API set. |
Ah, that now explains it. You are using a second copy of our loader. |
The PR is sound if we were to accept that you'll need to use a different loader for imgui_impl_opengl3 in its own compilation unit, but right now there is no reason to do it. (*) By accepting your use we'd be explicitly taking on the burden that our loader that wasn't designed for other users suddenly become something we should support. OpenGL ecosystem is enough of a mess we don't want our forked loader to be a project we'd provide maintenance for. We explicitely worked on this to stay as far as we could from the mess that is the GL loader ecosystem. TL;DR; please use any of the million available loaders or even gl3w, but don't use imgl3w in your project please. (*) And whenever we find another reason that this is useful we can merge this change, but right now I can't merge it for this reason. |
Closing this. Stance of #4649 (comment) stands, you should not use our custom loader for your code we cannot support it (you can use stock GL3W though). Sorry for that. |
In case of Windows and custom loader file, no OpenGL API is visible to OpenGL3 implementation.
It is needed to include loader header that provides it.
Can be provided via CMake for example:
target_compile_definitions(target PRIVATE IMGUI_IMPL_OPENGL_LOADER_CUSTOM="custom_opengl3_loader.h")